package com.hgsoft.pubsv.component.apifilter.util;

import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;

public class SetUtil {

	/**
	 * 是否在数组字符串中
	 * @param s
	 * @param setString
	 * @return
	 */
	public static boolean isInSets(String str, String setStr) {
		if(StringUtils.isBlank(setStr)) {
			return false;
		}
		String[] set = null;
		if (setStr.indexOf(",") == -1) {
			set = new String[]{setStr};
		} else {
			set = setStr.split("[,]");
		}
		if (ArrayUtils.contains(set, str)) {
			return true;
		}
		return false;
	}
	
	public static void main(String[] args) {
		String url = "/pubsv-xz-nm/api/wxsp/getUserOpenId";
		String urlSets = "/pubsv-xz-nm/api/wxsp/getUserOpenId,/pubsv-xz-nm/api/sign/wx/applySign,/pubsv-xz-nm/api/sign/wx/signInfo";
		System.out.println(isInSets(url, urlSets));
	}
}
